<?php

use Illuminate\Support\Facades\Route;


Route::prefix("manage")->namespace("App\Http\Controllers\Manage")->group(function () {
    Route::prefix("login")->group(function () {
        Route::get("", "LoginController@loginPageView")->name("manage.login");
        Route::post("in", "LoginController@loginInAction");
        Route::get("out", "LoginController@loginOutAction");
    });
    Route::get("captcha", "BasicController@getCaptcha");
    Route::middleware(["manage"])->group(function () {
        Route::post("login/setRole", "LoginController@adminSelectRole");
        Route::get("login/roleList", "LoginController@adminRoleList");
        Route::get("cache/clear", "HomeController@clearAllCache");
        Route::prefix("upload")->group(function () {
            Route::post("image", "BasicController@uploadImage");
        });
        Route::get("home", "HomeController@homePageView");
        Route::get("welcome", "HomeController@welcomePageView");
        Route::prefix("admin")->group(function () {
            Route::prefix("change")->group(function () {
                Route::get("info", "AdminController@changeOwnInfoView");
                Route::post("info", "AdminController@changeOwnInfoAction");
                Route::get("password", "AdminController@changeOwnPwdView");
                Route::post("password", "AdminController@changeOwnPwdAction");
            });
        });
        Route::prefix("system")->group(function () {
            Route::prefix("admin")->group(function () {
                Route::get("", "AdminController@pageTableView");
                Route::get("data", "AdminController@pageTableData");
                Route::post("add", "AdminController@addInfoAction");
                Route::post("edit", "AdminController@editInfoAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "AdminController@deleteInfoAction");
                    Route::get("status", "AdminController@statusInfoAction");
                    Route::post("password", "AdminController@passwordInfoAction");
                    Route::get("info", "AdminController@changeInfoView");
                    Route::post("info", "AdminController@changeInfoAction");
                });
            });
            Route::prefix("role")->group(function () {
                Route::get("", "RoleController@pageTableView");
                Route::get("data", "RoleController@pageTableData");
                Route::post("add", "RoleController@addInfoAction");
                Route::post("edit", "RoleController@editInfoAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "RoleController@deleteInfoAction");
                    Route::get("status", "RoleController@statusInfoAction");
                });
            });
            Route::prefix("rule")->group(function () {
                Route::get("", "RuleController@pageTableView");
                Route::get("data", "RuleController@pageTableData");
                Route::post("add", "RuleController@addInfoAction");
                Route::post("edit", "RuleController@editInfoAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "RuleController@deleteInfoAction");
                    Route::get("status", "RuleController@statusInfoAction");
                });
            });
            Route::prefix("config")->group(function () {
                Route::get("", "SystemController@systemConfigView");
                Route::get("data", "SystemController@systemConfigTableData");
                Route::get("status", "SystemController@systemConfigStatusAction");
                Route::post("add", "SystemController@systemConfigAddAction");
                Route::post("edit", "SystemController@systemConfigEditAction");
            });
            Route::prefix("department")->group(function () {
                Route::get("", "DepartmentController@pageTableView");
                Route::get("data", "DepartmentController@pageTableData");
                Route::post("add", "DepartmentController@addInfoAction");
                Route::post("edit", "DepartmentController@editInfoAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "DepartmentController@deleteInfoAction");
                    Route::get("status", "DepartmentController@statusInfoAction");
                    Route::get("info", "DepartmentController@changeInfoView");
                    Route::post("info", "DepartmentController@changeInfoAction");
                });
            });
        });
        Route::prefix("website")->group(function () {
            Route::prefix("article")->group(function () {
                Route::get("", "WebsiteController@pageTableArticleView");
                Route::get("data", "WebsiteController@pageTableArticleData");
                Route::post("add", "WebsiteController@addInfoArticleAction");
                Route::post("edit", "WebsiteController@editInfoArticleAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "WebsiteController@deleteInfoArticleAction");
                    Route::get("status", "WebsiteController@statusInfoArticleAction");
                });
            });
            Route::prefix("category")->group(function () {
                Route::get("", "WebsiteController@pageTableCategoryView");
                Route::get("data", "WebsiteController@pageTableCategoryData");
                Route::post("add", "WebsiteController@addInfoCategoryAction");
                Route::post("edit", "WebsiteController@editInfoCategoryAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "WebsiteController@deleteInfoCategoryAction");
                    Route::get("status", "WebsiteController@statusInfoCategoryAction");
                });
            });
            Route::prefix("banner")->group(function () {
                Route::get("", "WebsiteController@pageTableBannerView");
                Route::get("data", "WebsiteController@pageTableBannerData");
                Route::post("add", "WebsiteController@addInfoBannerAction");
                Route::post("edit", "WebsiteController@editInfoBannerAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "WebsiteController@deleteInfoBannerAction");
                    Route::get("status", "WebsiteController@statusInfoBannerAction");
                    Route::post("image", "WebsiteController@uploadImageBannerAction");
                });
            });
            Route::prefix("navigation")->group(function () {
                Route::get("", "WebsiteController@pageTableNavigationView");
                Route::get("data", "WebsiteController@pageTableNavigationData");
                Route::post("add", "WebsiteController@addInfoNavigationAction");
                Route::post("edit", "WebsiteController@editInfoNavigationAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "WebsiteController@deleteInfoNavigationAction");
                    Route::get("status", "WebsiteController@statusInfoNavigationAction");
                });
            });
            Route::prefix("template")->group(function () {
                Route::get("", "WebsiteController@pageTableTemplateView");
                Route::get("data", "WebsiteController@pageTableTemplateData");
                Route::post("add", "WebsiteController@addInfoTemplateAction");
                Route::post("edit", "WebsiteController@editInfoTemplateAction");
                Route::prefix("{code}")->group(function () {
                    Route::get("delete", "WebsiteController@deleteInfoTemplateAction");
                    Route::get("status", "WebsiteController@statusInfoTemplateAction");
                });
            });
        });
    });
});

Route::fallback(function () {
    return view('404');
});
